/**
 created by xwy 2018/2/24 10:21
 user: 13720092498@163.com
 **/

var express = require('express')
var app = express()
var fs =require('fs')
var url = require('url')
app.get('/', function (req, res) {

    var html = ''
    fs.readFile('./serve/test.html', 'utf8', function (err, data) {
        if (err) {
            console.error(err)
        } else {
           html = data
        }

    })
    console.log(html)
    res.end(html)


})
app.get('/example/b', function (req, res, next) {
    console.log('response will be sent by the next function ...');
    console.log(req.query)
    next();
}, function (req, res) {
    res.send('Hello from B!');
});
var server = app.listen(3000, function () {
    var host = server.address().address;
    var port = server.address().port;

    console.log('listen', host, port);
})
